In here are the list of things I did for a particular hour or day. Also included here are the screenshots of games I played, or videos I watched or listened to, or just random things I stumbled upon. I'll occasionally write down what I'm thinking, or things I'm planning to do.
Worked on SN, I fixed the datetime so that it server-renders the date with UTC format, then converts that to localtime on the client side. I also added some textbox to easily view HN URLs.
I also looked at the fly logs why my cached json arent' working, it seems that they get deleted before the scheduled time. The logs says it periodically shutdowns the machine when the server is inactive. The fix is to use actual fly.io volumes for persistent storage.
And my quest to devise my own manual long division continues. I tried dividing and factoring several numbers numbers in my notebook, some small and some large-ish. Several observations:
735 = 7*10^2 + 3*10^1 + 5
= 7*5*2*5*2 + 3*5*2 + 5
= 5(7*2*5*2 + 3*2 + 1)
So here, I could see at a glance that 735 is evenly divisible by 5, without doing full division or factoring.
Sadly, this doesn't necessarily mean that if I don't see any obvious factors then it's a prime number. Naively I thought that was the case, I quickly ran into counterexamples, most damning of which is the quadruply nice number 469, which is a product of two prime numbers 7 and 67!?! My supposed method broke down, all is lost, god is dead and/or mad, what am I even doing with my life again.
Just kidding (maybe). I'm just missing some important detail.
469
= (2^4)(5^2) + (2^2)(3)(5) + 3(3)
Here, there are no obvious factors in sight. In some cases, that actually does mean it's a prime number, but in this particular case, it's not, since it's factors are 7(67)
469
= 6(7)
Hmm, so my task is now to figure out how to go from 6(67) to (2^4)(5^2) + (2^2)(3)(5) + 3(3), or vise versa. If I could do that, then maybe I could observe some properties that could be generalized as a solution to finding the factors.
Then a thought occured to me: what are real numbers? Do they even exist? Aren't they just an artifact of decimal notation? Of course, some math teacher would bonk me in the head, and point to irrational numbers. But no, what if I want to reject the concept of real numbers, out of uncalled spite, and that irrational numbers can be perfectly expressed as a ratio of two numbers, with some slight tweak in the notation and the base axioms. Maybe these dumb irrationals belong on a separate number line.
Okay, if I'm asking these crazy questions, it's time to take a break. I'll probably answer and disprove my own questions sooner or later as I go along.
To continue from yesterday, to find a way to do factoring and division, I have to ask, what does division mean anyway? What does evenly divisible mean? What's remainder? With some faint recollection of some wikipedia article, after some scribbling, I manage to come up with:
x = ab + c
This equation says that a number can be expressed as a product of two numbers a and b, plus another number c. Meaning, if a number can be perfectly described as as a product of two numbers, then c can be zero. So, c here is the remainder.
Moving stuffs around:
x = ab + c (1)
x - ab = c (2)
xa~ = b + ca~ (3)
With (2), I could let c = 0 and find two numbers a and b that satisfies the equation. Not sure what to make of (3). If a is a factor of x, then c = 0, so
xa~ = b
For example, I want to divide 65 by 2:
65 = 2*x + c
What x could be here? Let me try some values:
Let x = 31
65 = 2*31 + c
65 = 62 + c
65 - 62 = c
c = 3
So with x = 31, get a remainder of 3.
What about if I let Let x = 32
65 = 2*32 + c
65 = 64 + c
c = 1
With x = 33, c = -1
What does this all mean for me? What does a negative remainder mean, and why don't I see it in the wild? Setting that aside for now, from here it's clear that 65 cannot be evenly be divided by 2 (where c = 0). But if I want to divide by 2 anyway, I get 32 with a remainder of 1.
Checking it in python:
>>> 65/2
32.5
Huh? Where's that 0.5 came from? Isn't the remainder 1? Of course, I would get 32.5 too if I did the division method taught in gradeschool, but why? Previously,
xa~ = b + ca~ (3)
Plugging in the values:
65*2~ = 32 + 1*2~
= 32 + 0.5
= 32.5
Oh okay, that makes sense. Alternatively,
32.5 = 32 + 5*10~
= 32 + 1*2~
And from that, I feel like I have a slightly deeper understanding of what division and decimal notation means. Sure, I could have saved myself the trouble of feeling retarded for not knowing these very basic things by looking it up, but it's a different rewarding experience to learn these things on my own.
Then again, I still don't have a methodical approach of doing long division besides doing trial and error. On the other hand, I could now do fizzbuzz without using the modulo operator. Well, actually I already did that before using a weird alien assembly language , but still.
site last updated on 2024-10-16 | created with moontpl